<?php
use Symfony\Component\HttpFoundation\Response;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/repositories/{repository}/{path}', 'RepositoryController@get')->where(['path' => '.*']);
//Route::put('/repositories/{name}/{path}', 'RepositoryController@upload')->where(['path' => '.*']);

Route::get('/repositories/{name}', function($name){
	return view('repositories.maven')->with(['repository' => App\Repository::where('name', $name)->firstOrFail()]);
});

Route::view('/dashboard/repository', 'dashboard.repository.index', ['repositories' => App\Repository::all()]);
Route::view('/dashboard/repository/add', 'dashboard.repository.add');
Route::middleware('auth')->post('/dashboard/repository/add', 'ManageController@addRepository');
Route::middleware('auth')->post('/dashboard/repository/{name}/edit', 'ManageController@editRepository');

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
